@helper RenderTimelineGrid(WebGrid grid) {
@grid.GetHtml(
        tableStyle: "tw-timeline",
        columns: grid.Columns(                    
                        grid.Column(
                                style: "tw-image",
                                format: @<text>
                                            <img width="48" height="48" alt="@item.user.name" src="@item.user.profile_image_url"/>
                                        </text>),
                        grid.Column(
                                style: "tw-message",
                                format: @<text>
                                            <span class="tw-message-content">
                                                <strong><a href="http://twitter.com/@item.user.screen_name">@item.user.screen_name</a></strong>
                                                <span>@item.text</span>
                                             </span>
                                            <span class="tw-message-metadata">@Twitter.ParseDateTime(item.created_at)</span>
                                        </text>)))
}

@functions {

    public static string RetrieveCallbackUrl(string returnUrl) {
        var hostUrl = Request.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped);
        var returnUrlParam = "?returnUrl=" + Server.UrlEncode(returnUrl.TrimStart('/'));
        var callbackUrl = hostUrl + VirtualPathUtility.GetDirectory(Request.FilePath) + Href("~/Twitter/RequestToken") + returnUrlParam;   
        
        return callbackUrl;
    }

}